-
Notifications
You must be signed in to change notification settings - Fork 3
Add datadog lib #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Jonathon McMurray <jonathon.mcmurray@aquaq.co.uk>
…o big changes). All tests still pass
Co-authored-by: Joseph Muldoon <joseph.muldoon@dataintellect.com>
Co-authored-by: Ben Lord <ben.lord@dataintellect.com>
Example json objects (adapted from datadog docs) have been added in corresponding files. (These will of course be removed eventually and are just for reverse engineering the dictionary formats to go into .j.j)
| opsys:.z.o; | ||
|
|
||
|
|
||
| /eventtitle,eventtext,eventdate,hostname,priority,alerttype,tags,aggregation_key,source_type_name,related_event_id,device,category,cr_name,cr_type,integration_id,message,timestamp,change_metadata,new_value,prev_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this for?
| if[(first baseurlversion)=`v2;( | ||
| if[(`$category)=`$"alert"; | ||
| json:.j.j(enlist`data)!enlist(`attributes`type!(enlist(`aggregation_key`attributes`category`integration_id`message`tags`timestamp`title!(aggregation_key;enlist(`custom`links`priority`status!(custom;enlist(`category`title`url!(linkcategory;linktitle;linkurl));priority;status));category;integration_id;message;tags;timestamp;title);alerttype)))]; | ||
| / if[(`$category)=`$"change"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't leave commented out code, if this isn't needed, remove it
| }; | ||
|
|
||
| / the following two functions are used to push data to datadog through https post using .Q.hp | ||
| / the following two functions are used to push data to datadog through https post usSingSS .Q.hp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seem to be a few extra Ss in this comment
| metriclog,:(.z.p;.z.h;metric;metricname;`float$metricvalue;0b;response); | ||
| win.sendmetric:{[(pars!args):metfilter] | ||
| leaders:([metricname:"";metricvalue:":";metrictype:"|";samplerate:"|@";tags:"|#"]); | ||
| (metricname;metricvalue):args 0 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this assumes that metricname & metricvalue are first two keys of dictionary passed in, do we want to enforce that?
| if[useweb;(requiredpars:`metric`points;optionalpars:`interval`tags`type)]; | ||
| if[useweb;( | ||
| if[(first baseurlversion)=`v1;optionalpars,:`host]; | ||
| if[(first baseurlversion)=`v2;optionalpars,:`unit`source_typename`resource_name`resource_type`origin_metric_type`origin_product`origin_service])]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if[useweb;(requiredpars:`metric`points;optionalpars:`interval`tags`type)]; | |
| if[useweb;( | |
| if[(first baseurlversion)=`v1;optionalpars,:`host]; | |
| if[(first baseurlversion)=`v2;optionalpars,:`unit`source_typename`resource_name`resource_type`origin_metric_type`origin_product`origin_service])]; | |
| if[useweb;requiredpars:`metric`points;optionalpars:`interval`tags`type; | |
| if[(first baseurlversion)=`v1;optionalpars,:`host]; | |
| if[(first baseurlversion)=`v2;optionalpars,:`unit`source_typename`resource_name`resource_type`origin_metric_type`origin_product`origin_service] | |
| ]; |
I think this is the same, with less unnecessary brackets etc.
Based on TorQ's datadog.q script
All funcs tested on q 4.1 on homer (Linux)
All funcs tested on q 4.1 locally (Windows 11)